package cn.iocoder.yudao.module.product.selection.job;

import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.module.product.selection.service.ZXHXProductSelectionSyncService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

/**
 * 供应链数据同步 Job
 *
 * @author 山野羡民
 */
@Component(value = "zxhxProductSelectionSyncJob")
public class ZXHXProductSelectionSyncJob implements JobHandler {

    @Resource
    private ZXHXProductSelectionSyncService zxhxProductSelectionSyncService;

    @Override
    //@TenantJob
    public String execute(String param) throws Exception {
        int initCount = zxhxProductSelectionSyncService.autoInit(0, 100);
        int addCount = zxhxProductSelectionSyncService.autoAdd();
        int removeCount = zxhxProductSelectionSyncService.autoRemove();
        int updateCount = zxhxProductSelectionSyncService.autoModify();
        return StrUtil.format("供应链选品数据自动同步：初始化 {} 条，新增 {} 条，移除 {} 条，修改 {} 条", initCount, addCount, removeCount, updateCount);
    }

}
